package com.gjxjl.jdbc.gateway.config;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

import java.util.List;

public class ProxyConfig {
    private final Config config;

    public ProxyConfig() {
        this.config = ConfigFactory.load();
    }

    public int getProxyPort() {
        return config.getInt("proxy.port");
    }

    public String getBackendHost() {
        return config.getString("backend.host");
    }

    public int getBackendPort() {
        return config.getInt("backend.port");
    }

    public String getDefaultDatabase() {
        return config.getString("backend.default-database");
    }

    public String getBackendUsername() {
        return config.getString("backend.username");
    }

    public String getBackendPassword() {
        return config.getString("backend.password");
    }

    public boolean isEnableLogging() {
        return config.getBoolean("proxy.enable-logging");
    }

    public boolean isEnableMetrics() {
        return config.getBoolean("proxy.enable-metrics");
    }

    public List<String> getBlockedSqlPatterns() {
        return config.getStringList("security.blocked-sql-patterns");
    }

    public int getMaxConnections() {
        return config.getInt("proxy.max-connections");
    }

    public long getConnectionTimeout() {
        return config.getLong("proxy.connection-timeout");
    }
}
